/**************敌机类**************/
function EnemyPlane(type, x, y, speed ) {
	this.node = document.createElement('img');
	this.type = type;
	this.x = x;
	this.y = y;
	this.speed = speed;
	this.blood;
	this.score;
	this.harm;

	this.init();
}

EnemyPlane.prototype.init = function() {
	// 获取初始值
	this.blood = planeArr[`${this.type}`].blood;
	this.score = planeArr[`${this.type}`].score;
	this.harm = planeArr[`${this.type}`].harm;

	// 设置样式
	this.node.src = 'img/'+planeArr[`${this.type}`].src;
	this.node.style.position = 'absolute';
	this.node.style.left = this.x + 'px';
	this.node.style.top = this.y + 'px';
	this.node.style.height = planeArr[`${this.type}`].height + 'px';
	this.node.style.width = planeArr[`${this.type}`].width + 'px';

	canvas.appendChild(this.node);
}

EnemyPlane.prototype.move = function() {
	if (this.y > cHeight) { // 如果超出边界
		canvas.removeChild(this.node);
		return true;
	}
	this.y += this.speed;
	this.node.style.top = this.y + 'px';
}

EnemyPlane.prototype.injured = function() {
	if (this.blood - arguments[0] <= 0) {
		dieAnimation(this);
		return true;
	} else {
		this.blood -= arguments[0];
		return false;
	}
}
/**************敌机类**************/
